Crate apperr

source ·
Expand description

AppErr is a wrapper object intended to hold application-specific errors.

The archetypal use-case is to allow applications that call library runtimes which call application callbacks to allow the application callbacks to return application-specific errors back to itself through the runtime.

In order to lessen the risk of wrapping an unintended type, the AppErr constructor only take in types that implement apperr::Blessed (which is a subtrait of std::error::Error).

Alternatives

There are other ways to solve the same problem, but they are not always feasible.

  • Traits can use associated types to declare the application-specific error types.
  • A generic parameter can be used to declare the application-specific error type.
  • Global variables can be used to store error information.

Structs

  • An error type used to pass an application-specific error through a library runtime.

Traits

  • Marker trait used to bless a type so that it can be used as a application-specific error.